﻿/*-----------------------------------------------
// File: PalaboraProjectile.cs
// Description: 抛物线抛射物, 重力加速度
// Author: Shaobing	492057342@qq.com
-----------------------------------------------*/
using UnityEngine;
using System.Collections;

namespace Battle.View
{
    //public class PalaboraProjectile : BattleProjectile 
    //{
    //    public Vector3 initPosition;
    //    public Vector3 targetPosition;

    //    public const float g = -9.8f;

    //    float initYSpeed;
    //    float xSpeed;
    //    float zSpeed;

        

    //    protected override void Shoot0()
    //    {
    //        var targetBC = BattleViewCtrl.GetInstance().GetBattleCharacter(targetCamp, targetFPId);
    //        if (targetBC != null)
    //        {
    //            if (!string.IsNullOrEmpty(projResData.targetBindBone))
    //            {
    //                targetPosition = targetBC.GetBonePosition(projResData.targetBindBone);
    //            }
    //            else {
    //                targetPosition = targetBC.GetBeFoundBonePosition();
    //            }
    //        }
    //        else {
    //            targetPosition = BattleViewCtrl.GetInstance().GetPosition(targetFPId, targetCamp);
    //        }

    //        initPosition = creator.transform.localPosition + projResData.initOffset;

    //        initYSpeed = -0.5f * g * flyTime;

    //        xSpeed = (targetPosition.x - initPosition.x) / flyTime;
    //        zSpeed = (targetPosition.z - initPosition.z) / flyTime;

    //        transform.SetParent(BattleViewCtrl.GetInstance().transform);
    //        transform.localPosition = initPosition;
    //        transform.localScale = Vector3.one;
    //        transform.localEulerAngles = Vector3.zero;

    //        delatTime = 0f;
    //    }


    //    float delatTime = 0f;
    //    public override void Tick()
    //    {
    //        delatTime += Time.deltaTime;
    //        if (delatTime <= flyTime)
    //        {
    //            float yPos = initYSpeed * delatTime + 0.5f * g * delatTime * delatTime;
    //            float xPos = delatTime * xSpeed + initPosition.x;
    //            float zPos = delatTime * zSpeed + initPosition.z;
    //            var newPos = new Vector3(xPos, yPos, zPos);
    //            transform.LookAt(newPos);
    //            transform.localPosition = newPos;
    //            Debug.Log(newPos);
    //        }
    //    }




    //}
}
